package com.xsomnus.algorithm.common.timerwheel;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DelayedOperation extends TimerTask {

    private String name;

    public DelayedOperation(long delayMs, String name) {
        super.delayMs = delayMs;
        this.name = name;
    }

    @Override
    public void run() {
        System.out.println(name + " [" + Thread.currentThread().getId() + "]---- do my job ----"+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
